#include "Stair.h"
#include "Listtexture.h"
#include "Define.h"

Stair::Stair(void){}
Stair::~Stair(void){}
Stair::Stair (int left, int top, int _id, int _type)
{
	if (_type == _STAIR_LEFT)
	{
		sprite = new Sprite(Listtexture::STAIR_LEFT,Listtexture::STAIR_WIDTH,Listtexture::STAIR_HEIGHT,
			Listtexture::STAIR_COUNT,Listtexture::STAIR_SPRITEPERROW);
		id = _id;
		type = _type;
	}
	else if (_type == _STAIR_RIGHT)
	{
		sprite = new Sprite(Listtexture::STAIR_RIGHT,Listtexture::STAIR_WIDTH,Listtexture::STAIR_HEIGHT,
			Listtexture::STAIR_COUNT,Listtexture::STAIR_SPRITEPERROW);
		id = _id;
		type = _type;
	}
	width = Listtexture::STAIR_WIDTH;
	height = Listtexture::STAIR_HEIGHT;
	UpdateRect(left,top,width,height);
	animateRate = Listtexture::STAIR_ANIMATE;
	lastAnimate = GetTickCount();
}
void Stair::update()
{
	DWORD now = GetTickCount();
	if(now - lastAnimate > animateRate)
	{
		sprite->Next();
		lastAnimate = now;
	}
}